using System;
using System.Net;
using System.Net.Mail;

namespace GoldStone.Common.Wrap {
    public class Mail {
        private String from = "", to = "", subject = "", body = "", smtp = "", username = "", password = "";
        private SmtpClient client;

        public String Password {
            get { return password; }
            set { password = value; }
        }

        public String Username {
            get { return username; }
            set { username = value; }
        }

        public String Smtp {
            get { return smtp; }
            set {
                smtp = value;
                client = new SmtpClient(smtp);
            }
        }

        public String Body {
            get { return body; }
            set { body = value; }
        }

        public String Subject {
            get { return subject; }
            set { subject = value; }
        }

        public String To {
            get { return to; }
            set { to = value; }
        }

        public String From {
            get { return from; }
            set { from = value; }
        }

        public void Send() {
            client.Credentials = new NetworkCredential(username, password);
            client.Send(from, to, subject, body);
        }
    }
}